package com.jianggujin.redis.dialog;

import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import com.jianggujin.redis.MainFrame;

public class RedisInfoDialog extends AbstractDialog {
    private JTextArea infoArea;

    private RedisInfoDialog(MainFrame parent, String info) {
        super(parent);
    }

    @Override
    protected void initComponent() {
        infoArea = new JTextArea();
        infoArea.setEditable(false);
        add(new JScrollPane(infoArea));
    }

    @Override
    protected void initDialog() {
        setTitle("Info");
        setSize(450, 400);
        super.initDialog();
    }

    public static void showInfo(MainFrame parent, String info) {
        RedisInfoDialog dialog = new RedisInfoDialog(parent, info);
        dialog.infoArea.setText(info);
        dialog.setVisible(true);
    }
}
